package swordoffer.offer40;

import java.util.ArrayList;
import java.util.Arrays;

public class SortSolution {
    public ArrayList<Integer> GetLeastNumbers_Solution(int [] input, int k) {
        ArrayList<Integer> res = new ArrayList<>();
        int len = input.length;
        if(k == 0 || k > len){
            return res;
        }
        Arrays.sort(input);
        for(int i = 0; i < k; i++){
            res.add(input[i]);
        }
        return res;
    }
}
